<?php
class Db_Login extends MVC_SQL {
	public function __construct(){
		$this->setTable('ams_admin');
	}
	public function check_login($oModel)
	{
		
		$admin_username=$oModel->getData('admin_username');
		$admin_password=md5($oModel->getData('admin_password'));
		/*$sSql = " SELECT * FROM ams_admin WHERE";
		$row = $this->getRecordsetByPKExtend($sSql);
		print_r($row);
		*/
                if(MODE == "FO"){
                    $sSql = " SELECT * FROM ams_admin WHERE admin_username = '{$admin_username}' AND admin_password ='{$admin_password}' AND admin_role = 3";
                }
                else{
                    $sSql = " SELECT * FROM ams_admin WHERE admin_username = '{$admin_username}' AND admin_password ='{$admin_password}' AND ( admin_role = 1 OR admin_role = 2)";
                }
		return $this->getRecordsetByPKExtend($sSql);
	}
}
?>